using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraBars;
using MiragePWF.Common.Container;
using Wolfut.MirageEE.UI.UIBaseComponents;

using Wolfut.MirageEE.UI.UI.Common;

namespace Wolfut.MirageEE.Client
{
    public partial class MainForm : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        public MainForm()
        {
            InitializeComponent();
        }

        #region "ShowMdiForm"
        private void ShowMdiForm(string formName)
        {
            this.Cursor = Cursors.WaitCursor;

            MirageEEFormBase form = IOC.Resolve<MirageEEFormBase>(formName) as MirageEEFormBase;
            foreach (MirageEEFormBase frm in this.MdiChildren)
            {
                if (frm.Name == form.Name)
                {
                    frm.Activate();
                    form = frm;
                    break;
                }
            }
            form.MdiParent = this;
            form.WindowState = this.WindowState;
            form.Show();
            this.Cursor = Cursors.Arrow;
        }
        #endregion

        private void barButtonItemSysSetting_ItemClick(object sender, ItemClickEventArgs e)
        {
            ShowMdiForm("SysParamForm");
        }

        private void barButtonItemCurrencyCategory_ItemClick(object sender, ItemClickEventArgs e)
        {
            ShowMdiForm("CurrencyCategoryForm");
        }

        private void barButtonItemCodeRules_ItemClick(object sender, ItemClickEventArgs e)
        {
            ShowMdiForm("CodeRuleForm");
        }

        private void barButtonItemBillCodeRules_ItemClick(object sender, ItemClickEventArgs e)
        {
            ShowMdiForm("BillCodeRuleForm");
        }

        private void barButtonItemProject_ItemClick(object sender, ItemClickEventArgs e)
        {
            ShowMdiForm("ProjectForm");
        }

        private void barButtonItemCompany_ItemClick(object sender, ItemClickEventArgs e)
        {
            ShowMdiForm("FirmForm");
        }

        private void barButtonItemDepartment_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.ShowMdiForm("DepartmentForm");
        }

        private void barButtonItemEmployee_ItemClick(object sender, ItemClickEventArgs e)
        {
            ShowMdiForm("EmployeeForm");
        }

        private void barButtonItemSubject_ItemClick(object sender, ItemClickEventArgs e)
        {
            ShowMdiForm("SubjectForm");
        }

        private void barButtonItemSupplierList_ItemClick(object sender, ItemClickEventArgs e)
        {
            ShowMdiForm("SupplierMainForm");
        }

        private void barButtonItemSupplierEdit_ItemClick(object sender, ItemClickEventArgs e)
        {
            ShowMdiForm("SupplierEditForm");
        }             
    }
}